Skip to content

Conversation

@TLWebdesign
Copy link

@TLWebdesign TLWebdesign commented Nov 10, 2025

Pull Request for Issue #46419.

Summary of Changes

Remove the false flag for "auto" on the setFrom method from PHPMailer in the MailTemplateFactory. This will improve the standard Joomla e-mail deliverability because now the Return-Path, envelope-from and From are aligned.
By default Joomla was setting this "auto" flag to false. Although PHPMailer's default is "true".

The behaviour won't change for reply-to. E-mail clients already use From as the fallback if there is no reply-to set.
Bounces now are sent to the wrong place for instance [email protected] instead of the "from mail" set in the configuration, this fix solves that issue.
With this fix SPF and DMARC domains will now be aligned and with that improve e-mail deliverability.

Testing Instructions

Set your "Mailer" to PHP Mail in Global Configuration -> Server -> Mail -> Mailer
Send an e-mail using the test e-mail from the configuration or do a lost password check.
Check e-mail headers and see that headers don't align.

Actual result BEFORE applying this Pull Request

Return-Path and envelope-from DON'T match the From.

Return-Path: <[email protected]>
    (envelope-from <[email protected]>)
From: Example Name <[email protected]>

Expected result AFTER applying this Pull Request

Return-Path and envelope-from DO match the From.

Return-Path: <[email protected]>
(envelope-from <[email protected]>)
From: Example Name <[email protected]>

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

I've set the setSender auto flag to true so the DKIM and SPF domains will align the domain form the envelope-from and Return Path with the "from" e-mail address.
@TLWebdesign TLWebdesign changed the title Fix for envelope-from & return path alignment with From in MailTemplateFactory [5.4] Fix for envelope-from & return path alignment with From in MailTemplateFactory Nov 10, 2025
@brianteeman
Copy link
Contributor

I dont see any difference with the headers after applying this PR

image

@TLWebdesign
Copy link
Author

Hi @brianteeman did you use SMTP? according to your headers it looks like you did. This test is about PHPMailer not SMTP. I'll update my instruction to make that more clear. Thanks for testing!

@exlemor
Copy link

exlemor commented Nov 11, 2025

I have tested this item ✅ successfully on 5e090e7

I have successfully tested this. The BEFORE and AFTER match PR description - thanks @TLWebdesign.

(In my case, it didn't alter my SPF, DKIM, etc results they were before and after PASS but cool for those configs where it would cause issues)

Thanks for the contribution :)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46431.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants